/**
 * 产品添加
 */
var comValidform=null;
var returnStatus=false;
var productInfoAdd={
	dataCache:null,
	
	startEvent:function(){
		$("#recordTab ul").idTabs();
		var introduceUE = UE.getEditor('introduce',{
			initialFrameHeight:340,
			initialFrameWidth:898
		});
		var incomeUE = UE.getEditor('income',{
			initialFrameHeight:340,
			initialFrameWidth:898
		});
		var riskctrlUE = UE.getEditor('riskctrl',{
			initialFrameHeight:340,
			initialFrameWidth:898
		});
		
		comValidform=$(".com-addForm").Validform({
			datatype:{
				"m0-2" : /^[0-9]+(.[0-9]{1,2})?$/
			},
			tiptype:2,
			tipSweep:true,
			beforeSubmit:function(curform){
				var url = 'mgr/ProductInfoCtrl/saveProductInfo';
				var params = jsUtils.serializeJson($('.com-addForm'));
				var introduce=introduceUE.getContent();
				params.introduce=introduce;
				
				var income=incomeUE.getContent();
				params.income=income;
				
				var riskctrl=riskctrlUE.getContent();
				params.riskctrl=riskctrl;
				
				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode=='200'){
						//关闭窗口并刷新数据
						art.dialog.close();
						returnStatus=true;
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	init:function(){
		productInfoAdd.startEvent();
	}
}
$(document).ready(function() {
	productInfoAdd.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}